package com.yuma.bootstrapdemo;

import java.util.Objects;
import java.util.Optional;

class A{
    static int a = 10;
    int aa = 20;

    static{
        System.out.println("A 静态块, a= " + 10);
    }
    public A(){
        System.out.println("A 构造,aa = " + aa);
    }

    {
        System.out.println("A 非静态块，aa=" + aa);
    }
}

class B extends A{
    static int b = 10;
    int bb = 20;

    static{
        System.out.println("B 静态块, b= " + 10);
    }
    public B(){
        System.out.println("B 构造, bb = " + aa);
    }

    {
        System.out.println("B 非静态块，bb=" + aa);
    }
}


public class BootstrapOrderDemo {
    public static void main(String[] args) {
        B bb = new B();

        String str = "world";
        Optional<String> s = Optional.ofNullable(str);
        // 如果str有值则返回，否则返回兜底的"hello"
        String s1 = s.orElse("hello");
        System.out.println(s1);

        Objects.isNull(str);
    }
}
